#include <iostream>
#include <string>
#include <cstdio>
 
using namespace std;

int const SLEN = 30;
 
struct student {
    string fullname;
    string hobby;
    int ooplevel;
};
 
int getinfo(student pa[], int n) {
    string temp_fullname;
    string temp_hobby;
    int temp_ooplevel;

    for (int i = 0; i < n ; ++i ){
        cout << "Student #" << i+1 << endl;
        cout << "Name: ";
        cin >> temp_fullname;

        if (temp_fullname == "") {
            cout << "temp_fullname == \"\"" << endl;
            return i;
        }
        cout << "Hobby: ";
        cin >> temp_hobby;
        cout << "OOP Level: ";
        cin >> temp_ooplevel;

        pa[i].fullname = temp_fullname;
        pa[i].hobby = temp_hobby;
        pa[i].ooplevel = temp_ooplevel;

        cout << endl;
    }
    return n;
}

void inner_display1(student st) {
    cout << "\nStudent's name: " << st.fullname;
    cout << "\nHobby: " << st.hobby;
    cout << "\nOOP Level: " << st.ooplevel ;
}

void display1(student st) {
    cout << "\n\n============= Display1 (student st)======";
    inner_display1(st);
    cout << "\n============= END OF Display1 (student st)======";
}

void display2(const student * ps) {
    cout << "\n\n--------------- Display2 (const student * ps)----";
    cout << "\n&Student's name: " << ps->fullname ;
    cout << "\n&Hobby: " << ps->hobby ;
    cout << "\n&OOP Level: " << ps->ooplevel ;
    cout << "\n--------------- END OF Display2 (const student * ps)----" ;
}

void display3(const student pa[], int n) {
    cout << "\n\n========= Display3 ========" ;
    for (int i = 0; i < n ; ++i ){
        inner_display1(pa[i]);
        cout << "\n------------";
    }
    cout << "\n\n========= END OF Display3 ========";
}
 
int main() {
     
    cout << "Enter class size: ";
    int class_size;
    cin >> class_size;
     

    struct student st[class_size];

    class_size = getinfo(st, class_size);

    if (class_size == 0) {
        cout << "Oops...you've entered empty line for name..terminating" << endl;
        return 0;
    }


    display3(st, class_size);

    int s_num;
    cout << endl << "Enter student#: ";
    cin >> s_num;

    display1(st[s_num-1]);
    display2(&(st[s_num-1]));

    cout << "\nID: u1234567" << endl;
    return 0;
}
